package com.trkj.service;


import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.trkj.dao.jpa.IjlExamineApplyDAO;
import com.trkj.pojos.JlExamineApply;


@Service
@Transactional
public class JlExamineApplyService {
	@Autowired
	private IjlExamineApplyDAO ExamineApplyDAO;
	/*
	 * 查看信息BigDecimal Id
	 */
	public Map<String, Object> finExamineApplypage(int page, int rows){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlExamineApply> list = ExamineApplyDAO.finExamineApplypage(pr);
		//获取总的记录条数
		long total = ExamineApplyDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	
	public Map<String, Object> finic_ExamineApplypage(int page, int rows,BigDecimal Id){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlExamineApply> list = ExamineApplyDAO.finic_ExamineApplypage(pr,Id);
		//获取总的记录条数
		long total = ExamineApplyDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	
	public Map<String, Object> finExamineApplypage_byOfficeName(int page, int rows,String officeName){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlExamineApply> list = ExamineApplyDAO.finExamineApplypage_byOfficeName(pr,officeName);
		//获取总的记录条数
		long total = ExamineApplyDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	
	public Map<String, Object> finExamineApplypageing(int page, int rows){
		PageRequest pr = new PageRequest(page - 1, rows);
		//获取当前页的记录
		List<JlExamineApply> list = ExamineApplyDAO.finExamineApplypageing(pr);
		//获取总的记录条数
		long total = ExamineApplyDAO.count();
		
		Map<String, Object> map = new HashMap<>();
		map.put("total", total);
		map.put("rows", list);
		return map;
	}
	public void addExamineApply(JlExamineApply s){
		ExamineApplyDAO.save(s);
	}
	//查找最大的编号
	public long  maxExamineApply(){
		return ExamineApplyDAO.maxExamineApply();
	}
	public List<JlExamineApply>  icidtoexamineapply(BigDecimal ieId){
		return ExamineApplyDAO.icidtoexamineapply(ieId);
	}
	public List<JlExamineApply>  pidtoexamineapply(String ieId){
		return ExamineApplyDAO.pidtoexamineapply(ieId);
	}

	
}
